<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline">
        <a-row :gutter="24">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="姓名">
              <a-input placeholder="请输入姓名" v-model="queryParam.xm"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="职业认证">
              <j-dict-select-tag
                v-model="queryParam.zyksid"
                placeholder="请选择"
                dictCode="edu_dev.ve_jw_ks_zhiye,name,id"
              ></j-dict-select-tag>
            </a-form-item>
          </a-col>

          <a-col :xl="6" :lg="7" :md="8" :sm="24" style="margin-right: 100px">
            <a-form-item label="年级">
<!--              <j-dict-select-tag-->
<!--                v-model="queryParam.gradeid"-->
<!--                placeholder="请选择"-->
<!--                dictCode="gradeid"-->
<!--              ></j-dict-select-tag>-->
              <j-select-grade  placeholder="请选择年级" v-model="queryParam.gradeid"></j-select-grade>
            </a-form-item>
          </a-col>

          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="专业部">
<!--              <j-dict-select-tag v-model="queryParam.falid" placeholder="请选择" dictCode="falid"></j-dict-select-tag>-->
              <j-select-zyb  v-model="queryParam.falid" placeholder="请选择专业部" @input="zybChange"></j-select-zyb>
            </a-form-item>
          </a-col>

          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="专业">
              <j-select-zy-by-zyb ref="zyByZyb" placeholder="请先选择专业部" v-model="queryParam.specid" @input="zyChange"></j-select-zy-by-zyb>
<!--              <j-dict-select-tag v-model="queryParam.specid" placeholder="请先选择专业部" dictCode="specid"></j-dict-select-tag>-->
            </a-form-item>
          </a-col>

          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="班级">
              <j-select-banji-by-zy ref="banjiByZy" placeholder="请先选择专业" v-model="queryParam.xzbid"></j-select-banji-by-zy>
<!--              <a-select v-model="queryParam.xzbid">-->
<!--                <a-select-option v-for="item in classes" :key="item.id" :value="item.id">-->
<!--                  {{ item.name }}-->
<!--                </a-select-option>-->
<!--              </a-select>-->
            </a-form-item>
          </a-col>

          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
               <edu-button type="5" @click="searchQuery" icon="search" title="搜索"
                           style="margin-bottom: 0"></edu-button><edu-button type="7" @click="searchReset"
                                                                             icon="delete" title="清除"
                                                                             style="margin-bottom: 0"></edu-button>
<!--              <a @click="handleToggleSearch" style="margin-left: 8px">-->
<!--                {{ toggleSearchStatus ? '收起' : '展开' }}-->
<!--                <a-icon :type="toggleSearchStatus ? 'up' : 'down'" />-->
<!--              </a>-->
            </span>
          </a-col>
        </a-row>
        <!--<a-row :gutter="24">-->

        <!--<a-col :md="6" :sm="24">-->
        <!--<a-form-item label="项目名称">-->
        <!--<a-input placeholder="请输入项目名" v-model="queryParam.name"></a-input>-->
        <!--</a-form-item>-->
        <!--</a-col>-->
        <!--<a-col :md="6" :sm="24">-->
        <!--<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">-->
        <!--<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>-->
        <!--<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>-->
        <!--</span>-->
        <!--</a-col>-->

        <!--</a-row>-->
      </a-form>
    </div>

    <!-- 操作按钮区域 -->
    <div class="table-operator" :md="24" :sm="24" style="margin: 0px 0px 10px 2px">
      <!--<a-button @click="handleAdd" type="primary" icon="plus">添加</a-button>-->
      <edu-button type="primary" icon="import" @click="excelBanji" title="按班批量录入"></edu-button>

      <edu-button type="4" icon="import" @click="excelImport" title="导入"></edu-button>
<!--      <a-upload-->
<!--        name="file"-->
<!--        :showUploadList="false"-->
<!--        :multiple="false"-->
<!--        :headers="tokenHeader"-->
<!--        :action="importExcelUrl"-->
<!--        @change="handleImportExcel"-->
<!--      >-->
<!--        <a-button type="primary" icon="import">导入</a-button>-->
<!--      </a-upload>-->
      <edu-button type="2" icon="download" @click="handleExportXls('职业考试成绩')" title="导出"></edu-button>

      <edu-button type="1" @click="searchQuery" icon="sync" title="刷新"></edu-button>

      <a-dropdown v-if="selectedRowKeys.length > 0">
        <a-menu slot="overlay">
          <a-menu-item key="1" @click="batchDelConfirm">
            <edu-batch-delete-button ref="batchDelBtn" @del="batchDelAction"  type="4" title="删除"></edu-batch-delete-button>
          </a-menu-item>
        </a-menu>
        <edu-button type="10" title="批量操作" icon="down" style="margin-bottom: 0px" rightIcon="true">
        </edu-button>
      </a-dropdown>
    </div>

    <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择
        <a style="font-weight: 600">{{ selectedRowKeys.length }}</a
        >项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>

      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="showDataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
        @change="handleTableChange"
      >
        <span slot="action" slot-scope="text, record">
          <edu-label-button type="1" title="编辑" @click="handleEdit(record)"></edu-label-button>

          <!--<a @click="handleDetail(record)">统计</a>-->
          <a-divider type="vertical" />
          <!--          <a-upload name="file" :multiple="true" :action="fileUpload" :headers="headers" @change="handleChange">-->
          <!--            <a-button>-->
          <!--              <a-icon type="upload" > Click to Upload-->
          <!--              </a-icon>-->
          <!--            </a-button>-->
          <!--          </a-upload>-->
          <edu-label-button type="2" title="添加附件" @click="uploadInfo(record)"></edu-label-button>
          <!--<a-dropdown>-->
          <!--<a class="ant-dropdown-link">-->
          <!--更多 <a-icon type="down"/>-->
          <!--</a>-->
          <!--<a-menu slot="overlay">-->
          <!--<a-menu-item>-->
          <!--<a href="javascript:;" @click="handleDetail(record)">详情</a>-->
          <!--</a-menu-item>-->

          <!--<a-menu-item>-->
          <!--<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">-->
          <!--<a>删除</a>-->
          <!--</a-popconfirm>-->
          <!--</a-menu-item>-->
          <!--</a-menu>-->
          <!--</a-dropdown>-->
        </span>
      </a-table>
    </div>
    <!-- table区域-end -->

    <!-- 表单区域 -->
    <veJwCjZhiye-modal ref="modalForm" @ok="modalFormOk"></veJwCjZhiye-modal>
    <VeJwCjZhiyeExcelImportModal ref="modalFormImport" @ok="modalFormOk"></VeJwCjZhiyeExcelImportModal>


    <VeJwCjZhiyeExcelBatchModal ref="modalFormExcel" @ok="searchQuery"></VeJwCjZhiyeExcelBatchModal>
    <ve-jw-cj-zhiye-upload-modal ref="uploadModalForm" @ok="modalFormOK"></ve-jw-cj-zhiye-upload-modal>
  </a-card>
</template>

<script>
// import { EduListMixin } from '@/mixins/EduListMixin'
import { EduListMixin } from '@/mixins/KwglMixin'
import { EduUtils } from '@/mixins/EduUtils'
import { getAction } from '@/api/manage'
import VeJwCjZhiyeModal from './modules/VeJwCjZhiyeModal'
import VeJwCjZhiyeExcelBatchModal from './modules/VeJwCjZhiyeExcelBatchModal'
import VeJwCjZhiyeExcelImportModal from './modules/VeJwCjZhiyeExcelImportModal'

import { formatDate } from '@/utils/util'
import VeJwCjZhiyeUploadModal from './modules/VeJwCjZhiyeUploadModal'
import JSelectGrade from '../../components/kwglbiz/JSelectGrade'
import JSelectZyb from '../../components/kwglbiz/JSelectZyb'
import JSelectZyByZyb from '../../components/kwglbiz/JSelectZyByZyb'
import JSelectBanjiByZy from '../../components/kwglbiz/JSelectBanjiByZy'

export default {
  name: 'EduOrderTicketList',
  mixins: [EduListMixin, EduUtils],
  components: {
    JSelectBanjiByZy,
    JSelectZyByZyb,
    JSelectZyb,
    JSelectGrade,
    VeJwCjZhiyeUploadModal,
    VeJwCjZhiyeExcelImportModal,
    VeJwCjZhiyeModal,
    VeJwCjZhiyeExcelBatchModal,
  },
  data() {
    return {
      // fileUpload:window.CONFIG['domianURL']+"/sys/common/upload",
      // headers:{
      //   authorization:'authorization-text',
      // },

      description: 've_jw_cj_zhiye管理页面',
      classes: {},
      filterConfig:{
        "xzid":'',
        "stuid":'',
        "userid":'',
      },
      // 表头
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: 'center',
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          },
        },
        {
          title: '职业认证名称',
          align: 'center',
          dataIndex: 'zyksid_dictText',
        },
        {
          title: '姓名',
          align: 'center',
          dataIndex: 'xm',
        },
        {
          title: '学号',
          align: 'center',
          dataIndex: 'xh',
        },
        {
          title: '准考证号',
          align: 'center',
          dataIndex: 'zkzh',
        },
        {
          title: '证书号',
          align: 'center',
          dataIndex: 'zsh',
        },
        {
          title: '理论成绩',
          align: 'center',
          dataIndex: 'llcj',
        },
        {
          title: '实操成绩',
          align: 'center',
          dataIndex: 'sccj',
        },
        {
          title: '考试成绩',
          align: 'center',
          dataIndex: 'kscj',
        },
        {
          title: '通过状态',
          align: 'center',
          dataIndex: 'ispass_dictText',
        },
        {
          title: '年级',
          align: 'center',
          dataIndex: 'gradeidName',
        },
        {
          title: '专业部',
          align: 'center',
          dataIndex: 'falidName',
        },
        {
          title: '专业',
          align: 'center',
          dataIndex: 'specidName',
        },

        // {
        //   title:'学制ID',
        //   align:"center",
        //   dataIndex: 'xzid'
        // },

        {
          title: '行政班名称',
          align: 'center',
          dataIndex: 'xzbidName',
        },
        // {
        //   title:'学生ID',
        //   align:"center",
        //   dataIndex: 'stuid'
        // },
        // {
        //   title:'学生用户ID',
        //   align:"center",
        //   dataIndex: 'userid'
        // },
        // {
        //   title:'成绩录入人ID',
        //   align:"center",
        //   dataIndex: 'createuserid'
        // },
        // {
        //   title:'成绩录入日期时间（原日期时间合并）',
        //   align:"center",
        //   dataIndex: 'cjlrrqsj',
        //   customRender:function (text) {
        //     return !text?"":(text.length>10?text.substr(0,10):text)
        //   }
        // },
        // {
        //   title:'状态（0=初始，1=已录入，2=已提交）',
        //   align:"center",
        //   dataIndex: 'status'
        // },
        // {
        //   title:'终端ID',
        //   align:"center",
        //   dataIndex: 'terminalid'
        // },
        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          scopedSlots: { customRender: 'action' },
        },
      ],
      url: {
        list: '/jingsaiProject/veJwCjZhiye/list',
        delete: '/jingsaiProject/veJwCjZhiye/delete',
        deleteBatch: '/jingsaiProject/veJwCjZhiye/deleteBatch',
        exportXlsUrl: '/jingsaiProject/veJwCjZhiye/exportXls',
        importExcelUrl: 'jingsaiProject/veJwCjZhiye/importExcel',
        bjlist: '/jxzy/edu-teach/teach/veBaseBanji/list',
      },
      dictOptions: {},
      isorter: [],
    }
  },
  // created() {
  //   const token = Vue.is.get(ACCESS_TOKEN);
  //   this.headers = {"X-Access-Token":token}
  //   console.log(tiken)
  //   console.log(window._CONFIG['domianURL'])
  // },
  created() {
    this.getClass()
  },
  methods: {
    excelBanji(){
      this.$refs.modalFormExcel.select({zyb:'',zy:'',bj:'',ks:''});
      this.$refs.modalFormExcel.title = '按班导入'
      this.$refs.modalFormExcel.disableSubmit = false
    },
    excelImport(){
      this.$refs.modalFormImport.select({zyb:'',zy:'',bj:'',ks:''});
      this.$refs.modalFormImport.title = '导入'
      this.$refs.modalFormImport.disableSubmit = false
    },
    importExcelUrl: function () {
      return `${window._CONFIG['domianURL']}${this.url.importExcelUrl}`
    },
    zybChange(code) {
      if (this.$refs.zyByZyb != null) {
        this.$refs.zyByZyb.initDictData(code)
      }
    },
    zyChange(code){
      if (this.$refs.banjiByZy != null) {
        this.$refs.banjiByZy.initDictData(code)
      }
    },
    uploadInfo: function (record) {
      this.$refs.uploadModalForm.select(record)
      this.$refs.uploadModalForm.title = '文件上传'
      this.$refs.uploadModalForm.disableSubmit = false
    },
  },
}
</script>
<style scoped>
@import '~@assets/less/usercolor.less';
</style>